<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.psl.model.userlogin" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    userlogin userinfo = (userlogin) session.getAttribute("user");
    if (userinfo == null) {
        response.sendRedirect("/login.do");
    }%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="/assets/css/text.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/main.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/content.css" rel="stylesheet" type="text/css">
    <script language="javascript" src="/assets/js/common.js"></script>
    <script language="javascript" src="/assets/js/general.js"></script>
    <script language="JavaScript" type="text/JavaScript">
    </script>
    <style>
        #title {
            width: 92%;
            border: 0px;
            margin-bottom: 10px;
        }

        #title td {
            text-align: center;
            height: 20px;
            line-height: 150%
        }

        #title div {
            background-image: url(/assets/img/dot_02.gif);
            background-position: left top;
            background-repeat: no-repeat;
            margin: 0 auto;
            padding-left: 20px;
            text-align: left;
            width: 10%;
            font-size: 15px;
            font-weight: bold;
            color: #CC0000;
            letter-spacing: 2px;
        }
    </style>
    <style media="print">
        .nobtn {
            border: none;
        }
    </style>
</head>
<body>

<table cellspacing="0" cellpadding="0" id="title" align="center">
    <tbody>
    <tr>
        <td nowrap="nowrap">
            <div> 山东宜利达流体设备有限公司外协加工件/闸板铁芯外协包胶</div>
        </td>
    </tr>
    </tbody>
</table>


<table cellpadding="0" cellspacing="0" class="datalist" align="center">
    <tr>
        <th colspan="1">编号</th>
        <th colspan="1">名称</th>
        <th colspan="1">规格</th>
        <th colspan="1">操作</th>
    </tr>
    <form action="/gethname5.do" method="post">
        <tr>
            <td align="center" colspan="1"></td>
            <td align="center" colspan="1"><input name="h_name" type="text" value=""></td>
            <td align="center" colspan="1"><input name="h_size" type="text" value=""></td>
            <td align="center" colspan="1"><input type="submit" value="查询"/></td>
        </tr>
    </form>
    <c:if test="${not empty query}">
        <c:forEach items="${query}" var="q" varStatus="status">
            <script>
                function add ${status.count}() {
                    document.getElementById("h_no").value = document.form${status.count}.no.value;
                    document.getElementById("h_name").value = document.form${status.count}.name.value;
                    document.getElementById("h_size").value = document.form${status.count}.size.value;
                }
            </script>
            <form name="form${status.count}">
                <tr class="change">
                    <td align="center" colspan="1"><input type="hidden" id="no${status.count}" name="no"
                                                          value="${q.h_no}"/> ${q.h_no}</td>
                    <td align="center" colspan="1"><input type="hidden" id="name${status.count}" name="name"
                                                          value="${q.h_name}"/>${q.h_name}</td>
                    <td align="center" colspan="1"><input type="hidden" id="size${status.count}" name="size"
                                                          value="${q.h_size}"/>${q.h_size}</td>
                    <td align="center" colspan="1"><input type="button" value="添加" onclick="add${status.count}()"/></td>
                </tr>
            </form>
        </c:forEach>
    </c:if>
    </tbody>
</table>


<table cellspacing="0" cellpadding="0" class="datalist" align="center">
    <tbody>
    <tr>
        <td colspan="1" height="45">
            <form action="/wxupload.do" method="post">
                <input type="submit" value="保存为同一批次" class="nobtn">
            </form>
        </td>
        <td colspan="1" height="45">
            <input type="button" value="打印" class="nobtn" onclick="print();">
        </td>
    </tr>
    <form action="/wxAdd.do" method="post">
        <tr>
            <th height="25" colspan="3" align="center">序号</th>
            <td align="center" colspan="13"></td>
        </tr>
        <tr>
            <th height="25" align="center" colspan="3">编号</th>
            <td align="center" colspan="13">
                <input type="text" id="h_no" name="h_id" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">公司名称</th>
            <td align="center" colspan="13"><input type="text" name="h_area" value="" class="nobtn"></td>
        </tr>
        <tr>
            <th align="center" colspan="3">物品名称</th>
            <td align="center" colspan="13"><input type="text" id="h_name" name="h_name" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">规格</th>
            <td align="center" colspan="13"><input type="text" id="h_size" name="h_size" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">拉走数量</th>
            <td align="center" colspan="13"><input type="text" name="h_send" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">拉走时间</th>
            <td align="center" colspan="13"><input type="date" name="h_sendtime" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">回收数量</th>
            <td align="center" colspan="13"><input type="text" name="h_receipt" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">工序</th>
            <td align="center" colspan="13"><input type="text" name="gx" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">回收时间</th>
            <td align="center" colspan="13"><input type="date" name="h_receipttime" value="" class="nobtn"/></td>
        </tr>
        <tr>
            <th align="center" colspan="3">结余</th>
            <td align="center" colspan="13">自动计算</td>
        </tr>
        <tr>
            <th align="center" colspan="3">凭条编号</th>
            <td align="center" colspan="13">自动生成<input type="hidden" value="1" name="no" class="nobtn"/></td>
        </tr>
        <tr align="center">
            <td colspan="16"><input type="submit" value="保存" class="nobtn"/></td>
        </tr>
    </form>
    <tr>
        <td colspan="16" height="50px"></td>
    </tr>
    <tr>
        <th align="center" colspan="2">操作</th>
        <th height="25" align="center">序号</th>
        <th height="25" align="center">编号</th>
        <th align="center">公司名称</th>
        <th align="center">物品名称</th>
        <th align="center">规格</th>
        <th align="center">拉走数量</th>
        <th align="center">拉走时间</th>
        <th align="center">回收数量</th>
        <th align="center">工序</th>
        <th align="center">回收时间</th>
        <th align="center">结余</th>
        <th align="center">凭条编号</th>
    </tr>

    <c:forEach items="${ship}" var="wm">
        <form name="form${wm.id}" action="/wxupd.do" method="post">

            <script>
                function warning${wm.id}() {
                    var h_send =${wm.h_send};
                    var h_receipt = document.getElementById("h_receipt").value;
                    if (h_send < h_receipt) {
                        alert('回收数量不能大于送出数量，请检查输入内容');
                        return false;
                    }
                }
            </script>
            <tr>
                <td align="center" colspan="1">
                    <a href="/wxdetail.do?no=${wm.no}"><img src="/assets/img/view.gif"> </a>
                    <a href="/wxdel.do?id=${wm.id}"><img src="/assets/img/icodelete.gif"> </a>
                </td>
                <td colspan="1" align="center"><input type="submit" value="修改" class="nobtn"></td>
                <td align="center"><input type="hidden" name="id" value="${wm.id}">${wm.id}
                </td>
                <td align="center">${wm.h_id}
                </td>
                <td align="center">${wm.h_area}
                </td>
                <td align="center">${wm.h_name}
                </td>
                <td align="center">${wm.h_size}
                </td>
                <td align="center">${wm.h_send}
                </td>
                <td align="center">${wm.h_sendtime}
                </td>
                <td align="center"><input type="text" name="h_receipt"
                                          value="${wm.h_receipt}" id="h_receipt" class="nobtn"
                                          onkeyup="warning${wm.id}()"/></td>
                <td align="center">${wm.gx}</td>
                <td align="center"><input type="date" id="h_receipttime" name="h_receipttime"
                                          value="${wm.h_receipttime}" class="nobtn"/>
                </td>
                <td align="center">${wm.h_send-wm.h_receipt}</td>
                <td align="center">${wm.no}</td>
            </tr>
        </form>
    </c:forEach>
    </tbody>
</table>
</body>
</html>